import 'package:baidu_trace/call_back.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:baidu_trace/baidu_trace.dart';
import 'package:baidu_trace/baidu_trace_platform_interface.dart';
import 'package:baidu_trace/baidu_trace_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

class MockBaiduTracePlatform
    with MockPlatformInterfaceMixin
    implements BaiduTracePlatform {

  @override
  Future<String?> getPlatformVersion() => Future.value('42');

  @override
  Future<bool?> initSdk(Map<String,dynamic> args) {
    // TODO: implement initSdk
    throw UnimplementedError();
  }

  @override
  Future<bool?> addEntity(int tag, int serviceId, String entityName, {String? entityDesc, Map<String, String>? columns}) {
    // TODO: implement addEntity
    throw UnimplementedError();
  }

  @override
  Future<bool?> startGather() {
    // TODO: implement startGather
    throw UnimplementedError();
  }

  @override
  Future<bool?> startTrace(int serviceId, String entityName) {
    // TODO: implement startTrace
    throw UnimplementedError();
  }

  @override
  Future<bool?> stopGather() {
    // TODO: implement stopGather
    throw UnimplementedError();
  }

  @override
  Future<bool?> stopTrace(int serviceId, String entityName) {
    // TODO: implement stopTrace
    throw UnimplementedError();
  }

  @override
  Future<bool?> updateEntity(int tag, int serviceId, String entityName, {String? entityDesc, Map<String, String>? columns}) {
    // TODO: implement updateEntity
    throw UnimplementedError();
  }

  @override
  Stream<BaiduListener> getStream() {
    // TODO: implement getStream
    throw UnimplementedError();
  }

  @override
  void setTraceListener() {
    // TODO: implement setTraceListener
  }
}

void main() {
  final BaiduTracePlatform initialPlatform = BaiduTracePlatform.instance;

  test('$MethodChannelBaiduTrace is the default instance', () {
    expect(initialPlatform, isInstanceOf<MethodChannelBaiduTrace>());
  });

  test('getPlatformVersion', () async {
    BaiduTrace baiduTracePlugin = BaiduTrace();
    MockBaiduTracePlatform fakePlatform = MockBaiduTracePlatform();
    BaiduTracePlatform.instance = fakePlatform;

    expect(await baiduTracePlugin.getPlatformVersion(), '42');
  });
}
